window.phoenix&&(window.phoenix.buildInfo||(window.phoenix.buildInfo=[]),-1===window.phoenix.buildInfo.findIndex((e=>"Phoenix-experience"===e.MFE))&&window.phoenix.buildInfo.push({MFE:"Phoenix-experience",VERSION:"rc-phoenix-experience-1.1.26105.1370789671-5a319f99-4-gb151444",LASTCOMMITDATETIME:"2024-07-12T10:57:26+00:00"})) /*! * * ============= BUILD INFO ============= * MFE: Phoenix-experience * chunkName: clientlib-experience-forms/index * VERSION: rc-phoenix-experience-1.1.26105.1370789671-5a319f99-4-gb151444 * BRANCH: HEAD * COMMITHASH: b15144446b0aeb869603529fd56baec1576b10c9 * LASTCOMMITDATETIME: 2024-07-12T10:57:26+00:00 * ============= If you're reading this, why not come work with us? https://www.t-mobile.com/careers ============= */,function(){"use strict";var e={6906:function(e,i,t){t.d(i,{w:function(){return n}});const o={appName:"phoenix-experience",className:"formSubmit"},n=e=>{const i=e.querySelector("[name=pardot_extra_field]"),t=e.querySelector("[name='Adobe MCID']"),n=e.querySelector("[name=adobe_trans_id]"),s=e.querySelector("[name=CMPID]"),r=e.querySelector("[name=GCLID]"),d=e.querySelector("[name=aam_uid]"),h=encodeURI(window.digitalData?.internal?.adobeVisitorId||""),l=a(38),c=encodeURI(new URLSearchParams(window.location.search).get("cmpid")||window.Cookies.get("cmp_id")||""),p=encodeURI(window.Cookies.get("_gcl_aw")||""),f=encodeURI(window.Cookies.get("aam_uuid")||"");i?i.value="":window.phoenix.log.error("Could not find pardot extra field",o),t?t.value=h:window.phoenix.log.error("Could not find Adobe AmcID field",o),n?n.value=l:window.phoenix.log.error("Could not find adobe_trans_id field",o),s?s.value=c:window.phoenix.log.error("Could not find CMPID field",o),r?r.value=p:window.phoenix.log.error("Could not find GCLID field",o),d?d.value=f:window.phoenix.log.error("Could not find aam_uid field",o)},a=e=>{let i=11;if(e>i)return a(i)+a(e-i);i=Math.pow(10,e+1);const t=i/10;return(""+(Math.floor(Math.random()*(i-t+1))+t)).substring(1)}}},i={};function t(o){var n=i[o];if(void 0!==n)return n.exports;var a=i[o]={exports:{}};return e[o](a,a.exports,t),a.exports}t.d=function(e,i){for(var o in i)t.o(i,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:i[o]})},t.o=function(e,i){return Object.prototype.hasOwnProperty.call(e,i)},function(){async function e(e){try{const i=await fetch(e.url,{method:"POST",body:JSON.stringify(e.body),headers:{"Content-type":"application/json; charset=UTF-8"}});if(!i.ok)return void e.callbackFn("invalid",i.statusText);const t=await i.json();if(i.ok&&"statusCode"in t&&200!==t.statusCode)return void e.callbackFn("invalid",i.statusText);e.callbackFn("success",null)}catch(i){e.callbackFn("server",i.message)}}window.Alpine.data("formPhoneValidation",((i,t,o,n,a,s,r,d)=>({dialog:{},modalVerifyElement:{},modalVerifyId:"",formInputs:{},formData:{phone:"",pin:""},formInputName:{phone:"",pin:""},phoneValidation:{templateId:""},init(){this.modalVerifyId=i,this.formInputs=t,this.hasPhoneNumberValidation=a||!1,this.phoneValidation.templateId=s,this.formInputName={phone:o||"",pin:n||""},this.hasPhoneNumberValidation&&window.phoenix.bus.publish("PHONE_VALIDATION","STATUS",{payload:{isValidated:!1}})},async openValidationDialog(e){const i=e.target;this.formData.pin="","true"!==i.getAttribute("aria-disabled")?await this.fetchGeneratePin():e.preventDefault()},async handleSendNewCode(){await this.fetchGeneratePin()},async handleValidation(){await this.fetchValidatePin()},async fetchGeneratePin(){const i=window.phoenix.configs?.apiDomainsConfigs?.["customer-verification-generate-pin"],t=`${i?.targetDomain}${i?.apiPath}`,o={msisdn:this.formInputs[`${this.formInputName.phone}`].cleave.rawValue,templateId:`${this.phoneValidation?.templateId}`};window.phoenix.bus.publish("ACTIVITY_SPINNER","SHOW"),window.phoenix.bus.publish("PHONE_VALIDATION","STATUS",{payload:{isValidated:!1}}),await e({url:t,body:o,callbackFn:this.handleGeneratePinResponse.bind(this)})},async fetchValidatePin(){const i=window.phoenix.configs?.apiDomainsConfigs?.["customer-verification-validate-pin"],t=`${i?.targetDomain}${i?.apiPath}`,o={msisdn:this.formInputs[`${this.formInputName.phone}`].cleave.rawValue,pin:this.formInputs[`${this.formInputName.pin}`].cleave.rawValue};window.phoenix.bus.publish("ACTIVITY_SPINNER","SHOW"),await e({url:t,body:o,callbackFn:this.handleValidatePinResponse.bind(this)})},handleValidatePinResponse(e,i){let t=!1;window.phoenix.bus.publish("ACTIVITY_SPINNER","HIDE"),window.phoenix.bus.publish("MODAL","CLOSE"),"success"===e&&(t=!0),"invalid"===e&&(t=!1,this.onErrorShowNotification(d)),window.phoenix.bus.publish("PHONE_VALIDATION","STATUS",{payload:{isValidated:t}})},handleGeneratePinResponse(e,i){window.phoenix.bus.publish("ACTIVITY_SPINNER","HIDE"),"success"===e&&window.phoenix.bus.publish("MODAL","OPEN_BY_ID",{payload:{componentId:this.modalVerifyId}}),"invalid"===e&&(window.phoenix.bus.publish("MODAL","CLOSE"),this.onErrorShowNotification(r))},onErrorShowNotification(e){window.phoenix.bus.publish("RUNTIME_NOTIFICATION","SHOW",{payload:{type:"ERROR",content:e,autoClose:6}})}}))),window.Alpine.data("formContainer",(()=>({id:void 0,form:void 0,formRefs:{node:{main:null,body:null,status:null,section:null,submit:null}},inputs:{},isFormClean:!1,isFormStarted:!1,isAnalyticsEnabled:!1,isLeadGenTypeForm:!1,hideForm:!1,phoneNumberValidation:{enabled:!1,isValidated:!0,templateId:"",errorMessage:""},init(){const e=this.$el?.getAttribute("data-xpr-form-config")||JSON.stringify("{}"),i=JSON.parse(e);this.inputElements=[...this.$el.querySelectorAll("[data-xpr-field]")],this.formRefs={node:{main:this.$el,body:this.$el?.querySelector("[data-xpr-form-body]")}},this.id=Symbol(this.formRefs.node.main?.id),this.formRefs.node.body.querySelectorAll("[type='hidden']").forEach((e=>{const i=e;switch(i.name){case"preferredLanguage":i.value="es"===document.documentElement.lang?"Spanish":"English";break;case"referralUrl":i.value=window.location.href;break;case"locale":i.value=document.documentElement.lang}})),window.phoenix.experience?.utils?.FormValidation&&(this.form=new window.phoenix.experience.utils.FormValidation(this.inputElements,this.$el),this.inputs=this.form.inputs,this.form.registerForm(this.id),this.isFormClean=this.form.validate()),this.$nextTick?.((()=>{this.form.publishFormValidity({formData:{...this.form.getFormData()},isValid:this.form.isFormValid})})),this.isAnalyticsEnabled=this.$el.hasAttribute("data-analytics-enable-tracking"),this.isLeadGenTypeForm=!!this.formRefs.node.main.querySelector("[data-xpr-lead-gen]"),this.phoneNumberValidation.enabled=this.$el.hasAttribute("data-xpr-form-phone-validation"),this.phoneNumberValidation.templateId=this.$el.getAttribute("data-xpr-form-phone-validation"),this.phoneNumberValidation.errorMessage=i?.messaging?.phoneValidation,window.phoenix.bus.subscribe("PHONE_VALIDATION","STATUS",this?.validatePhoneNumber.bind(this))},change(e){if(!this.inputs[e.target.name])return!1;this.isFormClean=this.form.validate(),this.form.handleFormChange(e),this.form.publishFormValidity({formData:{...this.form.getFormData()},isValid:this.form.isFormValid})},validatePhoneNumber(e){const i=e?.payload?.isValidated;this.phoneNumberValidation.enabled&&(this.phoneNumberValidation.isValidated=i)},validateForm(){if(this.phoneNumberValidation.isValidated||window.phoenix.bus.publish("RUNTIME_NOTIFICATION","SHOW",{payload:{type:"ERROR",content:this.phoneNumberValidation.errorMessage,autoClose:6}}),this.isFormClean&&this.phoneNumberValidation.isValidated)return void window.phoenix.bus.publish("FORM","VALID",{payload:{form:{$el:this.formRefs.node.main}}});const e=[];this.inputElements.map((i=>{i.reportValidity(),i.checkValidity()||e.push(i)})),e[0].focus()}})));var i=t(6906);function o(e,i){const t=new FormData(e),o={},n={};return t.forEach(((e,t)=>{if("formDefinitionURL"===t||"formIntegration"===t||"leadGenUrl"===t)n[t]=e;else if(Reflect.has(o,t)){const i=o[t];Array.isArray(i)||("boolean"==typeof i?o[t]=[i.toString()]:(File,o[t]=[i])),"boolean"==typeof e?o[t].push(e.toString()):(File,o[t].push(e))}else i&&!0===i[t]?.returnRawValue?o[t]=i[t]?.cleave.rawValue:o[t]=e})),n.formData=o,n}const n="GC";function a(){return JSON.parse(window.localStorage.getItem(n))||[]}function s(e,i){this.isFormResponsePending=!1,window.phoenix.bus.publish("ACTIVITY_SPINNER","HIDE");const t={payload:{error:"Error",form:{$el:this.formRefs.node.main}}};if("success"!==e)return this.submissionHasError=!0,this.displayFormResponse=!0,this.formResponseMessage="server"===e?this.formRefs.config?.messaging.server??this.formRefs.config?.messaging.error:this.formRefs.config?.messaging.error??i,t.payload&&(t.payload.message=this.formResponseMessage),void window.phoenix.bus.publish("FORM","ERROR",t);if(this.submissionHasError=!1,this.isAnalyticsEnabled){const e=this.formRefs.node.main?.cloneNode(!0);this.isLeadGenTypeForm&&e?.querySelector('input[type="checkbox"]')?.remove();const i={payload:{form:{$el:e}}};window.phoenix.bus.publish("FORM","COMPLETE",i)}switch(this.formRefs.config?.confirmationType){case"inline":this.displayFormResponse=!0,this.formResponseMessage=this.formRefs.config.messaging.success;break;case"gated":this.displayGatedContentSuccessTitle=!0,this.gatedContentSuccessTitle=this.formRefs.config?.messaging.gatedContentSuccessTitle,this.hideForm=!0,this.displayFormResponse=!0,this.formResponseMessage=this.formRefs.config?.messaging.gatedContentSuccessText,this.displayGatedContentPath=!0,this.gatedContentPathTitle=this.formRefs.config?.messaging.gatedContentPathTitle,this.gatedContentPath=this.formRefs.config?.messaging.gatedContentPath,function(e){const i=a();i.push({id:e,url:window.location.pathname}),window.localStorage.setItem(n,JSON.stringify(i))}(this.formRefs.node.main.id);break;case"section":this.displaySectionResponse=!0;break;case"redirect":window.location.href=this.formRefs.config?.redirectUrl}}window.Alpine.data("formSubmit",(t=>({formRefs:{node:{main:void 0,body:void 0,status:void 0,section:void 0,submit:void 0},config:{confirmationType:"",testDomain:"",formIntegration:"",redirectUrl:"",messaging:{success:"",error:"",server:"",phoneValidation:"",gatedContentPathTitle:"",gatedContentPath:"",gatedContentSuccessTitle:"",gatedContentSuccessText:""}}},isFormResponsePending:!1,submissionHasError:!1,displayFormResponse:!1,displaySectionResponse:!1,formResponseMessage:"",displayGatedContentSuccessTitle:!1,gatedContentSuccessTitle:"",displayGatedContentPath:!1,gatedContentPathTitle:"",gatedContentPath:"",hideForm:!1,formContainerInputs:{},recaptchaConfig:{container:{},siteKey:"",verificationEndpoint:"",isEnabled:!1,isValidated:!1,defaultWhenError:!1},init(){const e=this.$el?.closest("form")?.getAttribute("data-xpr-form-config")||JSON.stringify("{}");if(this.formContainerInputs=t,this.formRefs={node:{main:this.$el?.closest("form"),body:this.$el?.querySelector("[data-xpr-form-body]"),status:this.$el?.querySelector("[data-xpr-form-status]"),section:this.$el?.querySelector("[data-xpr-confirmation-section]"),submit:this.$el?.querySelector("[data-xpr-form-submit]")},config:JSON.parse(e)},(void 0===window.Granite||void 0===window.Granite.author)&&"gated"===this.formRefs.config?.confirmationType&&(i=this.formRefs.node.main?.id||"",a().filter((e=>e.id===i&&e.url===window.location.pathname)).length>0)&&(this.hideForm=!0,this.displayFormResponse=!0,this.formResponseMessage=this.formRefs.config.messaging.gatedContentSuccessText,this.displayGatedContentPath=!0,this.gatedContentPathTitle=this.formRefs.config?.messaging.gatedContentPathTitle,this.gatedContentPath=this.formRefs.config?.messaging.gatedContentPath,this.isAnalyticsEnabled)){const e=new DOMParser,i=this.formRefs.node.main?.getAttribute("data-analytics-component-title")?.trim(),t=e.parseFromString(this.formResponseMessage,"text/html").body.innerText.replace(/\n/g," ");window.phoenix.bus.publish("ANALYTICS","MESSAGE",{payload:{message:`Message : ${t}`,formName:i}})}var i;window.phoenix.bus.subscribe("FORM","VALID",(e=>{e?.payload?.form?.$el===this.formRefs?.node.main&&this.submitForm()})),this.buildRecaptchaConfigs()},buildRecaptchaConfigs(){const e=document.querySelector("[data-xpr-recaptcha-config]");e&&(this.recaptchaConfig.container=e,this.recaptchaConfig.isEnabled=this.recaptchaConfig?.container&&this.$el?.hasAttribute("data-xpr-recaptcha-enabled")||!1,this.recaptchaConfig.siteKey=this.recaptchaConfig?.container?.dataset?.xprRecaptchaSiteKey||"",this.recaptchaConfig.verificationEndpoint=this.recaptchaConfig?.container?.dataset?.xprRecaptchaApiUrl||"",this.recaptchaConfig.defaultWhenError=this.recaptchaConfig.container&&this.recaptchaConfig?.container?.hasAttribute("data-xpr-recaptcha-response-for-error"))},subscribeToBusEvents(){window.phoenix.bus.subscribe("RECAPTCHA","RECAPTCHA_VERIFY_SUCCESS",this.handleRecaptchaSuccess?.bind(this)),window.phoenix.bus.subscribe("RECAPTCHA","RECAPTCHA_VERIFY_FAILURE",this.handleRecaptchaFailure?.bind(this)),window.phoenix.bus.subscribe("RECAPTCHA","RECAPTCHA_EXECUTION_FAILURE",this.handleRecaptchaFailure?.bind(this))},async submitForm(){if(window.phoenix.bus.publish("ACTIVITY_SPINNER","SHOW"),!this.isFormResponsePending){if(this.isLeadGenTypeForm&&(0,i.w)(this.formRefs.node.main),this.recaptchaConfig.isEnabled)return this.recaptchaConfig.isValidated?void await this.postFormData(o(this.formRefs.node.main)):void this.initRecaptchaService();this.postFormData(o(this.formRefs.node.main,this.formContainerInputs))}},initRecaptchaService(){const e={recaptchaSiteKey:this.recaptchaConfig.siteKey,recaptchaVerifyEndpoint:this.recaptchaConfig.verificationEndpoint,recaptchaDefaultWhenError:this.recaptchaConfig.defaultWhenError};this.subscribeToBusEvents(),window.phoenix.bus.publish("RECAPTCHA","RECAPTCHA_VERIFY_INIT",{payload:{...e}})},async handleRecaptchaSuccess(){this.formRefs?.node?.main?.hasAttribute("data-xpr-form-captcha")&&this.recaptchaConfig.isEnabled&&!this.recaptchaConfig.isValidated&&(this.recaptchaConfig.isValidated=!0,await this.postFormData(o(this.formRefs.node.main)))},handleRecaptchaFailure(){s.bind(this)("invalid","Error During Form Submission")},async postFormData(i){this.isFormResponsePending=!0;const t=`${this.formRefs?.config?.testDomain||""}${this?.formRefs?.config?.formIntegration}`;await e({url:t,body:i,callbackFn:s.bind(this)})}})))}()}();